package svc

import (
	"HD_running/mall/order/api/internal/config"
	"HD_running/mall/order/api/model"
	"HD_running/mall/user/rpc/user"
	"github.com/zeromicro/go-zero/core/stores/postgres"
)

type ServiceContext struct {
	Config             config.Config
	UserRpc            user.User
	CclassModel        model.CclassModel
	DepartmentModel    model.DepartmentModel
	StudentcourseModel model.StudentcourseModel
	ProblemModel       model.ProblemModel
	ResultproModel     model.ResultproModel
}

func NewServiceContext(c config.Config) *ServiceContext {
	conn := postgres.New(c.PostgreSQL.Datasource)
	return &ServiceContext{
		Config:             c,
		CclassModel:        model.NewCclassModel(conn),
		DepartmentModel:    model.NewDepartmentModel(conn),
		StudentcourseModel: model.NewStudentcourseModel(conn),
		ProblemModel:       model.NewProblemModel(conn),
		ResultproModel:     model.NewResultproModel(conn),
	}
}
